API Documentation
Public Member Functions | List of all members
nkGraphics::MeshManager Class Referencefinal

Manages the meshes available in the component. More...

Inheritance diagram for nkGraphics::MeshManager:

Public Member Functions

 ~MeshManager ()
 
MeshcreateOrRetrieve (const nkMemory::StringView &name)
 
Meshget (const nkMemory::StringView &name) const
 
MeshgetByIndex (unsigned int index) const
 
void rename (const nkMemory::StringView &currentName, const nkMemory::StringView &newName)
 
void erase (const nkMemory::StringView &name)
 

Detailed Description

Manages the meshes available in the component.

The manager owns all memory allocated inside. External code should never delete it.

Constructor & Destructor Documentation

◆ ~MeshManager()

nkGraphics::MeshManager::~MeshManager ( )

Destructor.

Member Function Documentation

◆ createOrRetrieve()

Mesh* nkGraphics::MeshManager::createOrRetrieve ( const nkMemory::StringView name)

Creates if unavailable, or retrieves if available, a mesh.

Parameters
nameThe name of the mesh to retrieve.
Returns
The mesh requested, possibly freshly created. The manager owns the memory returned, external code should never free it. See erase().

◆ get()

Mesh* nkGraphics::MeshManager::get ( const nkMemory::StringView name) const

Retrieves an existing mesh.

Parameters
nameThe name of the mesh to retrieve.
Returns
The mesh requested if available, nullptr else.

◆ getByIndex()

Mesh* nkGraphics::MeshManager::getByIndex ( unsigned int  index) const

Retrieves a mesh by index. Note that an index can be attached to different meshes as the internal memory gets updated. Mainly used to go over all meshes in one go.

Parameters
indexThe index of the mesh to retrieve.
Returns
The mesh requested if available, nullptr else.

◆ rename()

void nkGraphics::MeshManager::rename ( const nkMemory::StringView currentName,
const nkMemory::StringView newName 
)

Renames a mesh, changing both its name and the way to access it through the manager.

Parameters
currentNameThe name of the mesh to rename.
newNameThe new name to assign to it.

◆ erase()

void nkGraphics::MeshManager::erase ( const nkMemory::StringView name)

Erases and frees the memory of a mesh.

Parameters
nameThe name of the mesh to erase.

The documentation for this class was generated from the following file: